import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;


export class Singleton<T>
{
    private static _Instance;
    static Instance<T>(): T {
        if (!this._Instance)
            this._Instance = new this();
        return this._Instance;
    }
}

export class ComSingleton<T> extends Component {
    protected static _Instance: any;

    static Instance<T>(): T {
        if (!this._Instance) {
            this._Instance = this;
        }
        return this._Instance;
    }
}